﻿@model LoginModel
@using Nop.Web.Models.Customer;
@using Nop.Core;
@using Nop.Core.Infrastructure;
@{
    Layout = "~/Views/Shared/_Root.cshtml";

    //title
    Html.AddTitleParts(T("PageTitle.Login").Text);

    //register URL with return URL (if specified)
    var registerUrl = Url.RouteUrl("Register");
    if (!String.IsNullOrEmpty(this.Context.Request.QueryString["returnUrl"]))
    {
        var webHelper = EngineContext.Current.Resolve<IWebHelper>();
        registerUrl = webHelper.ModifyQueryString(registerUrl, "returnurl=" + HttpUtility.UrlEncode(this.Context.Request.QueryString["returnUrl"]), null);
    }
}
<div class="page login-page">
    <div class="page-title">
        <h1>@T("Account.Login.Welcome")</h1>
    </div>
    <div class="page-body">
        <div class="returning-wrapper">
            <span class="login-title">@T("Account.Login.ReturningCustomer")</span>
            <div class="login-block">
                <div class="message-error">
                    @Html.ValidationSummary(true, T("Account.Login.Unsuccessful").Text)
                </div>
                @using (Html.BeginForm())
                {
                    if (Model.UsernamesEnabled)
                    {
                    <div>
                        @Html.LabelFor(m => m.Username)
                        @Html.TextBoxFor(m => m.Username)
                        @Html.ValidationMessageFor(m => m.Username)
                    </div>
                    }
                    else
                    {
                    <div>
                        @Html.LabelFor(m => m.Email)
                        @Html.TextBoxFor(m => m.Email)
                        @Html.ValidationMessageFor(m => m.Email)
                    </div>
                    }
                    <div>
                        @Html.LabelFor(m => m.Password)
                        @Html.PasswordFor(m => m.Password)
                        @Html.ValidationMessageFor(m => m.Password)
                    </div>
                    <div>
                        @Html.CheckBoxFor(m => m.RememberMe)
                        @Html.LabelFor(m => m.RememberMe)
                    </div>
                    if (Model.DisplayCaptcha)
                    {
                    <div class="captcha-box">
                        @Html.Raw(Html.GenerateCaptcha())
                    </div>
                    }
                    <div class="buttons">
                        <input type="submit" value="@T("Account.Login.LoginButton")" />
                    </div>
                    <div class="forgot-password">
                        @Html.RouteLink(T("Account.Login.ForgotPassword").Text, "PasswordRecovery")
                    </div>
                }
            </div>
        </div>
        @if (Model.CheckoutAsGuest)
        {
            <div class="new-wrapper">
                <span class="register-title">@T("Account.Login.CheckoutAsGuestOrRegister")</span>
                <div class="checkout-as-guest-or-register-block">
                    <div class="buttons">
                        <a href="@(Url.RouteUrl("Checkout"))" data-role="button">@T("Account.Login.CheckoutAsGuest")</a>
                        <a href="@registerUrl" data-role="button">@T("Account.Register")</a>
                    </div>
                </div>
            </div>
        }
        else
        {
            <div class="new-wrapper">
                <span class="register-title">@T("Account.Login.NewCustomer")</span>
                <div class="register-block">
                    <div class="buttons">
                        <a href="@registerUrl" data-role="button">@T("Account.Register")</a>
                    </div>
                </div>
            </div>
        }
    </div>
</div>
